package com.swg.cocobox.message;

import java.io.IOException;

public class MessagePackageUtil {

	public static int getMessagetPackagetType(MessagePackage messagePackage){
		int type=-1;
		try {
			String msg=messagePackage.getMessageDataString("UTF-8").trim();
			if(msg.startsWith(MessagePackage.TYPE_PREFIX)){
				String stype=msg.substring(MessagePackage.TYPE_PREFIX.length(), MessagePackage.TYPE_PREFIX.length()+1);
				type=Integer.parseInt(stype);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return type;
	}
}
